﻿@using Microsoft.AspNetCore.Components
@inject IJSRuntime JsRuntime


@if (Header != null)
{
    <MatH5>@Header</MatH5>
}

<div style="display: flex; flex-direction: column; padding: 10px;" class="mat-elevation-z5 mdc-theme--surface">
    <div style="padding: 5px; border: 1px solid white;" class="@Class">
        @Content
    </div>
    <div style="padding: 5px; font-family: monospace; overflow: auto;">
        <div>
            @SourceContent
        </div>
    </div>
    <div style="overflow: hidden; padding-top: 5px;">
        <ins class="adsbygoogle"
             style="display:block; text-align:center;"
             data-ad-layout="in-article"
             data-ad-format="fluid"
             data-ad-client="ca-pub-3904134905954949"
             data-ad-slot="7908819923">
        </ins>
    </div>
</div>


@code
{

    [Parameter]
    public string Class { get; set; }

    [Parameter]
    public string Header { get; set; }

    [Parameter]
    public RenderFragment Content { get; set; }

    [Parameter]
    public RenderFragment SourceContent { get; set; }

    [Parameter]
    public string SourcePath { get; set; }

    protected override void OnAfterRender(bool firstRender)
    {
        base.OnAfterRender(firstRender);
        if (firstRender)
        {
            JsRuntime.InvokeAsync<object>("matBlazorDemo.initAd");
        }
    }

}

